package com.fast.fastenjoy.base.dao.sqltemplate.transformer;

import java.util.List;

import javax.persistence.Entity;

import org.hibernate.transform.ResultTransformer;

import com.opensymphony.xwork2.util.AnnotationUtils;

/**
 * 数据转换器父类
 * @author chenliaohua
 *
 */
@SuppressWarnings("rawtypes")
public abstract class ResultTransformerEx implements ResultTransformer{

	private static final long serialVersionUID = -3175741017720244546L;
	
	protected Class<?> entityClass;
	
	public boolean isHibernateMapping(){
		
		return entityClass != null &&
				AnnotationUtils.findAnnotation(entityClass, Entity.class) != null;
	}
	
	public ResultTransformerEx(Class<?> entityClass){
		this.entityClass = entityClass;
	}
	
	public List transformList(List list) {
		return list;
	}
	
	public Class<?> getEntityClass() {
		return entityClass;
	}
	
}
